import { defineConfig } from 'vitepress'
const { feLinks, sidebar } = require('./utils/createSideBar').default;

// https://vitepress.dev/reference/site-config
export default defineConfig({
  lang: 'en-US',
  title: "前端学习圈",
  description: "文档笔记",
  head: [['link', { rel: 'icon', href: '/public/favicon.ico' }]],
  lastUpdated: true,
  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config
    nav: [
      { text: 'Home', link: '/' },
      { text: '旅行', link: '/src/tour/index.md' },
      { text: '卜卦', link: '/src/book/index.md' },
      { text: 'tools', link: '/src/tools/index.md' },
      { text: 'fe', items: feLinks }
    ],
    sidebar, // 侧边栏
    socialLinks: [
      { icon: 'github', link: 'https://github.com/vuejs/vitepress' }
    ],
    search: {
      provider: 'local',
      options: {
        _render(src, env, md) {
          const html = md.render(src, env)
          if (env.frontmatter?.search === false) return ''
          if (env.relativePath.startsWith('some/path')) return ''
          return html
        }
      }
    },
    footer: { // 页脚
      copyright: 'MIT Licensed | Copyright © 2021-present ZhaoPanP 冀ICP备2021010150号'
    },
    editLink: { // 编辑链接
      pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path'
    },
    lastUpdated: { // 最后更新时间戳
      text: '上次更新：',
      formatOptions: {
        dateStyle: 'full',
        timeStyle: 'medium'
      }
    },
  },
  markdown: {
    image: {
      // 默认禁用图片懒加载
      lazyLoading: true
    }
  }
})
